Repository navigation
storage: Add a FAILOVER option for PostgreSQL sources - #40686
peterdukelarsen merged 7 commits into
Conversation
PostgreSQL 17+ synchronizes a logical replication slot to standbys only if the slot was created with FAILOVER. A source's slot was created without it, so the slot did not survive an upstream failover. The new dyncfg `pg_source_replication_slot_failover` (default off) makes a source create its slot with FAILOVER. It is replica-scoped, so it can be targeted at single clusters. Servers that cannot create such a slot (older than PostgreSQL 17, or a standby) get a plain slot as before. Existing slots are not altered. Part of CS-752 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
66b89f8 to
43c87b8
Compare
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The checked-in src/sql/system-parameters.json lacked enable_postgres_source_failover, which failed the checked_in_catalog_is_current test in mz-system-parameter-catalog. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
patrickwwbutler
left a comment
There was a problem hiding this comment.
LGTM, all follows normal patterns for these things!
|
Instead of introducing a new flag, should we enabled this behavior only if |
Is there a scenario where someone would want |
Setting this flag on the slot only makes it eligible for synchronization, the user still has to set the PG server flag to enable the functionality. The scenario where a user wants to enable |
Motivation
PostgreSQL 17+ only synchronizes a logical replication slot to standbys if it was created with
FAILOVER, which PostgreSQL sources could not request (part of CS-752).Description
Adds a
FAILOVERoption toCREATE SOURCE ... FROM POSTGRES, gated by the feature flagenable_postgres_source_failover(default off), that creates the source's slot withFAILOVERand is rejected unless the upstream is a PostgreSQL 17+ primary.Verification
A new
replication-slot-failoverworkflow intest/pg-cdcchecks the feature flag gate and assertspg_replication_slots.failoverfor a source created with the option, and a parser test covers the syntax.🤖 Generated with Claude Code